#include <stdio.h>
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/opt.h>
}

int main()
{
    printf("%s\n", avcodec_configuration());
    // av_register_all();
    avformat_network_init();
    AVFormatContext* pFormat = NULL;
    const char*      version = av_version_info();
    printf("FFmpeg版本：%s\n", version);  // 示例输出：5.1.3
    // const char* path = "/home/u22/exchange_wsl/code/ffmpeg/src/11.mp4";
    // http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8
     const char* path = "rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid";
     AVDictionary* opt=NULL;
     av_dict_set(&opt, "rtsp_transport", "tcp", 0);
     av_dict_set(&opt, "max_delay", "550", 0);
     int ret  = avformat_open_input(&pFormat,path,NULL, &opt);
    // int ret = avformat_open_input(&pFormat, path, NULL, NULL);
    if (ret)
    {
        printf(" avformat_open_input failed\n");
        return -1;
    }
    printf(" avformat_open_input success\n");
    /**/
    ret = avformat_find_stream_info(pFormat, NULL);
    if (ret)
    {
        printf(" avformat_find_stream_info failed\n");
        return -1;
    }
    printf(" avformat_find_stream_info success\n");
    int time     = pFormat->duration;
    int mbittime = (time / 1000000) / 60;
    int mmintime = (time / 1000000) % 60;
    printf("&%d��:%d��\n", mbittime, mmintime);
    av_dump_format(pFormat, 0, path, 0);
    return 0;
}